#ifndef _FLASH_W25Q64JV_
#define _FLASH_W25Q64JV_

#include <stdint.h>

int W25Q64JV_init(void);
void W25Q64JV_exit(void);

/**************************************************************************************/
/*******************************************************************************/
/**************************************************************************************/


/** @defgroup status register 1 
 * @{
 */
int W25Q64JV_Read_StatusRegister1(uint8_t *reg);

// is busy?
#define W25Q64JV_IS_BUSY(status_register_1) (0x1 & (status_register_1))

// write enabled?
#define W25Q64JV_IS_WRITE_ENABLED(status_register_1) (0x2 & (status_register_1))

/** @} */

/**
 * @defgroup read Manufacturer ID and Device ID
 * @{
 */
 
int W25Q64JV_Read_ManufacturerIDAndDeviceID(uint8_t *mid, uint8_t *did);
 
/**
 * @}
 */
 
/** earse one sector */
int W25Q64JV_EraseSector(uint32_t dwSecStartAddr);

/** write data */
int W25Q64JV_PageProgram(uint32_t dwStartAddr, uint8_t *data_buf, uint32_t data_len);

/** read data */
int W25Q64JV_ReadData(uint32_t dwStartAddr, uint8_t *data_buf, int32_t data_len);

/** fast read data */
int W25Q64JV_FastReadData(uint32_t dwStartAddr, uint8_t *data_buf, int32_t data_len);

#endif
